﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GroupsList.aspx.cs" Inherits="ModulesToolkit.Web.Membership.GroupsList"
    Title="GroupsList" MasterPageFile="~/Shared/DefaultMaster.master" %>

<asp:Content ID="content" ContentPlaceHolderID="uxDefaultContentPlaceHolder" runat="Server">
    <h1>
        <img src="../Images/groupIco.png" style="vertical-align: middle" />
        Groups
    </h1>
    <div class="entryForm">
        <div>
            <asp:Label runat="server" ID="uxNameCaption" Text="Group" AssociatedControlID="uxName"></asp:Label>
            <asp:TextBox runat="server" ID="uxName"></asp:TextBox>
            <asp:Button runat="server" ID="uxSearch" Text="Search" OnClick="uxSearch_Click" />
        </div>
    </div>
    <div style="text-align: right; width: 500px">
        <asp:Button runat="server" ID="uxAdd" Text="Add" OnClick="uxAdd_Click" />
    </div>
    <br />
    <asp:UpdatePanel runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="uxSearch" />
        </Triggers>
        <ContentTemplate>
            <asp:UpdateProgress runat="server" DynamicLayout="true">
                <ProgressTemplate>
                    <div style="padding: 5px; padding-left: 20px; float: left">
                        <img alt="loading" src="../Images/ajax-loader1.gif" />
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
            <div class="GridContainer" style="width: 500px;">
                <asp:GridView runat="server" ID="uxGroupsList" DataSourceID="uxGroupsListSource"
                    OnRowCommand="uxGroupsList_RowCommand">
                    <Columns>
                        <asp:TemplateField HeaderText="Name" SortExpression="Name">
                            <ItemTemplate>
                                <asp:LinkButton runat="server" Text='<%# Eval("Name") %>' CommandName="Editing" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="LastUpdatedby" HeaderText="Updated by" SortExpression="LastUpdatedby" />
                        <asp:BoundField DataField="LastUpdatedDate" HeaderText="Last Updated" DataFormatString="{0:d}"
                            SortExpression="LastUpdatedDate" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="uxDeleteButton" runat="server" CommandName="Deleting" ImageUrl="~/Images/Delete16.png"
                                    CommandArgument='<%# Eval("Id") %>' />
                                <ajax:ConfirmButtonExtender runat="server" TargetControlID="uxDeleteButton" ConfirmText="<%$ Resources:Confirmation, 0001 %>">
                                </ajax:ConfirmButtonExtender>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <asp:Literal runat="server" Text='<%$ Resources:Content, 0001 %>'></asp:Literal>
                    </EmptyDataTemplate>
                </asp:GridView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <WCSF:ObjectContainerDataSource runat="server" ID="uxGroupsListSource" UsingServerPaging="true"
        UsingServerSorting="true" OnSelecting="uxGroupsList_Selecting" />
    <asp:UpdatePanel runat="server" ID="uxPopupUpdatePanel" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="uxAdd" />
        </Triggers>
        <ContentTemplate>
            <mtl:Popup runat="server" ID="uxGroupDetails" IsModel="true" Width="550px" CloseImageUrl="~/Images/close.png"
                Height="450px" Title="Group Details" CausesValidation="false">
                <ContentTemplate>
                    <div class="infoPanel">
                        <asp:Literal runat="server" Text='<%$ Resources:Content,0002 %>'></asp:Literal>
                    </div>
                    <asp:ValidationSummary runat="server" ValidationGroup="groupDetails" />
                    <ajax:TabContainer runat="server" ID="uxUsersRolesTabs" Height="280">
                        <ajax:TabPanel runat="server" HeaderText="Information">
                            <ContentTemplate>
                                <table class="entryForm">
                                    <tr>
                                        <td valign="top" rowspan="3">
                                            <img src="../Images/groupDetailsIco.png" />
                                        </td>
                                        <td>
                                            <asp:Label runat="server" Text="Name" AssociatedControlID="uxNameField">
                                            </asp:Label>
                                            *
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="uxNameField">
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator ID="uxNameFieldRequiredValidator" runat="server" Display="Dynamic"
                                                ControlToValidate="uxNameField" ValidationGroup="groupDetails" ErrorMessage="<%$Resources:Error, 0001 %>">
                                                    <asp:Image runat="server" ImageUrl="~/Images/warning.png" style=" vertical-align:middle" />
                                            </asp:RequiredFieldValidator>
                                            <asp:CustomValidator runat="server" ID="uxNameFieldDublicationValidator" Display="Dynamic"
                                                ControlToValidate="uxNameField" ValidationGroup="groupDetails" ErrorMessage="<%$ Resources:Error, 0003 %>"
                                                OnServerValidate="uxNameFieldDublicationValidator_ServerValidate">
                                                <asp:Image runat="server" ImageUrl="~/Images/warning.png" style=" vertical-align:middle" />
                                            </asp:CustomValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td valign="top">
                                            <asp:Label ID="uxDescriptionCaption" runat="server" Text="Description" AssociatedControlID="uxDescriptionField">
                                            </asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="uxDescriptionField" TextMode="MultiLine">
                                            </asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label runat="server" Text="Enabled" AssociatedControlID="uxIsEnabledField">
                                            </asp:Label>
                                            *
                                        </td>
                                        <td>
                                            <asp:CheckBox runat="server" ID="uxIsEnabledField" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </ajax:TabPanel>
                        <ajax:TabPanel runat="server" HeaderText="Roles">
                            <ContentTemplate>
                                <asp:GridView runat="server" ID="uxRolesList" SkinID="PopupSkin" DataSourceID="uxRolesListSource" OnRowDataBound="uxRolesList_RowDataBound">
                                    <EmptyDataTemplate>
                                        <asp:Literal runat="server" Text='<%$ Resources:Content, 0001 %>'></asp:Literal>
                                    </EmptyDataTemplate>
                                    <Columns>
                                        <asp:BoundField DataField="Name" HeaderText="Name">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </asp:BoundField>
                                        <asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Right" />
                                            <ItemTemplate>
                                                <asp:CheckBox runat="server" ID="uxIsRoleCheckedField" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                                <WCSF:ObjectContainerDataSource runat="server" ID="uxRolesListSource" UsingServerPaging="true"
                                    OnSelecting="uxRolesListSource_Selecting" />
                            </ContentTemplate>
                        </ajax:TabPanel>
                        <ajax:TabPanel runat="server" HeaderText="Users">
                            <ContentTemplate>
                                <asp:GridView runat="server" ID="uxMembersList" DataSourceID="uxMembersListSource"
                                    SkinID="PopupSkin" OnRowDataBound="uxMembersList_RowDataBound">
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Left" />
                                            <ItemTemplate>
                                                <asp:Image runat="server" ID="uxMemberImage" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="MemberName">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </asp:BoundField>
                                        <asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Right" />
                                            <ItemTemplate>
                                                <asp:LinkButton runat="server" ID="uxAddCommand" CommandName="Add" Text="Add"></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                                <WCSF:ObjectContainerDataSource runat="server" ID="uxMembersListSource" UsingServerPaging="true"
                                    OnSelecting="uxMembersListSource_Selecting" />
                                <hr />
                                <asp:GridView runat="server" ID="uxGroupMembersList" DataSourceID="uxGroupMembersListSource"
                                    SkinID="PopupSkin">
                                    <EmptyDataTemplate>
                                        <asp:Literal runat="server" Text='<%$ Resources:Content, 0001 %>'></asp:Literal>
                                    </EmptyDataTemplate>
                                    <Columns>
                                        <asp:BoundField DataField="MemberName" />
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:LinkButton runat="server" ID="uxRemoveCommand" CommandName="Remove" Text="Remove"></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                                <WCSF:ObjectContainerDataSource runat="server" ID="uxGroupMembersListSource" UsingServerPaging="true"
                                    OnSelecting="uxGroupMembersListSource_Selecting" />
                            </ContentTemplate>
                        </ajax:TabPanel>
                    </ajax:TabContainer>
                </ContentTemplate>
                <FooterTemplate>
                    <asp:Button runat="server" ID="uxOk" Text="OK" ValidationGroup="groupDetails" OnClick="uxOk_Click" />
                    <asp:Button runat="server" ID="uxCancel" Text="Cancel" OnClick="uxCancel_Click" CausesValidation="false" />
                </FooterTemplate>
            </mtl:Popup>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
